package com.meida.paotui.bus.provider.service.impl;

import com.meida.common.mybatis.base.service.impl.BaseServiceImpl;
import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.model.ListModel;
import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.common.security.OpenHelper;
import com.meida.paotui.bus.client.entity.BusCommonaddress;
import com.meida.paotui.bus.provider.mapper.BusCommonaddressMapper;
import com.meida.paotui.bus.provider.service.BusCommonaddressService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户常用地址 实现类
 *
 * @author flyme
 * @date 2019-11-06
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BusCommonaddressServiceImpl extends BaseServiceImpl<BusCommonaddressMapper, BusCommonaddress> implements BusCommonaddressService {
    @Override
    public ResultBody listEntityMap(ListModel model) {
        Long userId= OpenHelper.getUserId();
        CriteriaQuery<EntityMap> cq = new CriteriaQuery(model, BusCommonaddress.class);
        cq.select(BusCommonaddress.class, "*");
        cq.likeByField(BusCommonaddress.class, "address");
        cq.eq(BusCommonaddress.class,"userId",userId);
        return baseList(cq);
    }

}
